/**
 * <p>Title: EquipmentClass.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2011-12-20 下午02:50:24  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.common.zm.cInterface.ce;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;

/**
 * <p>Title: EquipmentClass.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2011-12-20 下午02:50:24  张志芳  Create
 *</pre>
 */
public class EquipmentClass {

	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 
	 * <p>Function: getEquipmentBlock</p>
	 * <p>Description: 获取设备卡片信息的block</p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-12-14下午04:42:32 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	public static EiBlock getEquipmentClassBlock(String blockName, Map params){                                                              
		EiBlock block = new EiBlock(blockName);
		
		EiColumn eiColumn = new EiColumn("fdKeyId");
		eiColumn.setPrimaryKey(true);
		eiColumn.setFieldLength(32);	
		eiColumn.setDescName("FD_KEY_ID");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdCode");
		eiColumn.setFieldLength(10);	
		eiColumn.setDescName("编号");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("fdName");
		eiColumn.setFieldLength(50);	
		eiColumn.setDescName("名称");
		block.addMeta(eiColumn);		
		
		eiColumn = new EiColumn("fdIsLeaf");
		eiColumn.setFieldLength(1);	
		//eiColumn.setType("N");
		eiColumn.setDescName("是否叶子");
		block.addMeta(eiColumn);

		eiColumn = new EiColumn("fdToencode");
		eiColumn.setFieldLength(20);	
		eiColumn.setDescName("内码");
		block.addMeta(eiColumn);
		
		List<Map> list = new ArrayList<Map>();
		list = getEquipmentClassList(params);
		block.setRows(list);
		return block;
	}
	
	/**
	 * 
	 * <p>Function: getEquipmentList</p>
	 * <p>Description: 获取设备卡片信息以“List<Map>”形式返回</p>
	 * <p>return value:List<Map></p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-12-14下午04:43:58 张小飞
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List<Map> getEquipmentClassList(Map params){
		List<Map>  _list = new ArrayList();
		try {
			_list = dao.query("ZMCEEquipmentClass.queryInterface", params);
		} catch (Exception e) {

		}
		return _list;
	}
}
